package pzl.com.threadlocal;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import pzl.com.threadlocal.tasks.Thread1;
import pzl.com.threadlocal.tasks.Thread2;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });

    }

    public void click(View view) {
        switch (view.getId()) {
            case R.id.btnShareInteger:
                int i = 0;
                while (i < 5) {
                    new Thread1().start();
                    i++;
                }
                break;
            case R.id.btnShareObject:
                int j = 0;
                while (j < 5) {
                    new Thread2().start();
                    j++;
                }
                break;
        }
    }


}
